package com.example.springmvcinterceptor.sertletComponent;

import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;
@Component
public class MyFilter implements Filter {
    @Override
    //init  初始化
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    @Override

    //doFilter  业务逻辑方法
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("自定义的myFilter");
        filterChain.doFilter(servletRequest,servletResponse);
    }

    @Override

    //destroy  交汇方法
    public void destroy() {
        Filter.super.destroy();
    }
}
